<%@page import="java.util.Map"%>
<%@page import="com.jiang.vo.Member"%>
<%@page import="java.util.List"%>
<%@page import="com.jiang.service.impl.MemberServiceImpl"%>
<%@page import="com.jiang.factory.ServiceFactory"%>
<%@page import="com.jiang.service.IMemberService"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户信息列表</title>
<link rel="stylesheet" type="text/css" href="css/basic.css" />
<link rel="stylesheet" type="text/css" href="css/table.css" />
<link rel="stylesheet" type="text/css" href="css/btn.css" />
<script type="text/javascript" src="js/member_list.js"></script>
</head>

<body>
	<%
		request.setCharacterEncoding("UTF-8");
		String columnData = "编号:mid|姓名:name"; //为插件option设置搜索可选项
		String column = "mid"; //默认查询的列名称
		String keyWord = ""; // 搜索关键字
		int allRecorders = 0; //总记录数
		int currentPage = 1;
		int lineSize = 5;
		String url = basePath + "member_list.jsp";
		// 服务端接收分页按钮点击或者搜索栏的搜索点击
		if (request.getParameter("cp") != null) {
			currentPage = Integer.parseInt(request.getParameter("cp"));
		}
		if (request.getParameter("ls") != null) {
			lineSize = Integer.parseInt(request.getParameter("ls"));
		}

		if (request.getParameter("kw") != null) {
			keyWord = new String(request.getParameter("kw").getBytes("ISO-8859-1"),"UTF-8");
		}
		if (request.getParameter("col") != null) {
			column = new String(request.getParameter("col").getBytes("ISO-8859-1"),"UTF-8");
		}

		// 分页查询
		IMemberService memberService = ServiceFactory.getInstance(MemberServiceImpl.class);
		Map<String, Object> reslut = memberService.findMemberSplit(column, keyWord, currentPage, lineSize);
		List<Member> members = (List<Member>) reslut.get("members");
		allRecorders = (Integer) reslut.get("total");
	%>


	<form action="#" method="post">
		<table id="mytable" cellpadding="5px" cellspacing="0px" width="100%"
			border="1px solid #000000">

			<tr>
				<th colspan="1" align="left">用户信息列表</th>
				<th colspan="1" align="left"><a href="member_add.jsp">添加信息</a>
				</th>
				<td colspan="6">
					<div id="splitSearchDiv">
						<jsp:include page="/split/split_page_plugin_search.jsp">
							<jsp:param name="columnData" value="<%=columnData%>" />
							<jsp:param name="column" value="<%=column%>" />
							<jsp:param name="keyWord" value="<%=keyWord%>" />
							<jsp:param name="allRecorders" value="<%=allRecorders%>" />
						</jsp:include>
					</div>
				</td>
			</tr>
			<tr>
				<td><input type="checkbox" id="info_chk_all" /></td>
				<td>用户编号</td>
				<td>真实姓名</td>
				<td>性别</td>
				<td>学历</td>
				<td>生日</td>
				<td>个人收入</td>
				<td>个人简介</td>
			</tr>
			<%
				for (Member m : members) {
			%>
			<tr>
				<td><input type="checkbox" id="info_chk"
					value="<%=m.getMid()%>" /></td>
				<td><a href="member_edit.jsp?mid=<%=m.getMid()%>"> <%=m.getMid()%>
				</a></td>
				<td><%=m.getName()%></td>
				<td><%=m.getSex()%></td>
				<td><%=m.getEdu()%></td>
				<td><%=m.getBirthday()%></td>
				<td><%=m.getSalary()%></td>
				<td><%=m.getNote()%></td>
			</tr>

			<%
				}
			%>
			<br />

		</table>
		<div id="splitBarDiv" style="float:right">
			<jsp:include page="split/split_page_plugin_bars.jsp">
				<jsp:param name="currentPage" value="<%=currentPage%>" />
				<jsp:param name="lineSize" value="<%=lineSize%>" />
				<jsp:param name="column" value="<%=column%>" />
				<jsp:param name="keyWord" value="<%=keyWord%>" />
				<jsp:param name="allRecorders" value="<%=allRecorders%>" />
				<jsp:param name="url" value="<%=url%>" />
			</jsp:include>
		</div>
		<br /> <input type="button" id="btn_del" value="删除选中数据"
			style="clear: both" />
	</form>

</body>

</html>